package operation;

import book.Book;
import book.BookList;

public class BorrowOperation implements IOperation{
    public void work(BookList bookList){
        System.out.println("借出图书");
        System.out.println("请输入要借阅的书的名字：");
        String name = scanner.nextLine();
        int size = bookList.getUseSide();
        for (int i = 0; i < size; i++){
            Book book = bookList.getBook(i);
            if (name.equals(book.getName())){
                book.setBorrow(true);
                System.out.println("借阅成功");
                System.out.println(book);
                return;
            }
        }
        System.out.println("没有找到这本书");
    }
}
